#pragma once

#include "Utility\Matrix.h"
#include "Utility\FixedArray.h"
#include "Utility\ColladaFile.h"


class Animation
{
public:
	Animation(int iBoneCount);
	~Animation(void);	

	typedef struct _sBone
	{
		u32							uName;
		FixedArray<Matrix>			aTransforms;
		FixedArray<float>			aTimes;
		int							iParent;

		_sBone(ColladaFile::sBone* sBone)
		{
			uName = sBone->uName;
			iParent = sBone->iParent;

			aTransforms.SetSize(sBone->aTransforms.GetNumElements());
			aTimes.SetSize(sBone->aTimes.GetNumElements());

			for(int i = 0; i < aTransforms.GetNumElements(); i++)
			{
				aTransforms[i] = sBone->aTransforms[i];
			}

			for(int i = 0; i < aTimes.GetNumElements(); i++)
			{
				aTimes[i] = sBone->aTimes[i];
			}

		}

	}sBone;

	int						BoneCount()					{ return  m_aBoneHierarchy.GetNumElements(); }
	int						GetBoneParent(int i)		{ return m_aBoneHierarchy[i]->iParent; }
	FixedArray<float>*		GetTimes(int i)				{ return &m_aBoneHierarchy[i]->aTimes; }
	FixedArray<Matrix>*		GetTransforms(int i)		{ return &m_aBoneHierarchy[i]->aTransforms; }
	
	void					AddBone(int iIndex, sBone* pBone) {	m_aBoneHierarchy[iIndex] = pBone; }	

protected:
	u32							m_uName;
	FixedArray<sBone*>			m_aBoneHierarchy;
};
